package com.gzhryc.shared_device.cdcz.core.protocol.v1;

import com.gzhryc.shared_device.cdcz.core.enums.ECDCZPlugOverloadState;
import com.gzhryc.shared_device.cdcz.core.enums.ECDCZPlugTemperatureState;
import com.gzhryc.shared_device.cdcz.core.protocol.v1.models.PlugBKVData;

public class V1_CDCZPlugStateUtils {

    public static Integer getOverloadState(PlugBKVData plugBKVData){
        if(plugBKVData.getNotLoad() == 1){
            return ECDCZPlugOverloadState.empty.index();
        }
        if(plugBKVData.getOverCurrent() == 1){
            return ECDCZPlugOverloadState.overCurrent.index();
        }
        if(plugBKVData.getOverloadState() == 1){
            return ECDCZPlugOverloadState.overload.index();
        }
        return ECDCZPlugOverloadState.Normal.index();
    }

    public static Integer geTemperatureState(PlugBKVData plugBKVData){
        if(plugBKVData.getTemperatureState() == 1){
            return ECDCZPlugTemperatureState.High.index();
        }
        return ECDCZPlugTemperatureState.Normal.index();
    }
}
